<template>
    <div class="rights-box">
        <el-breadcrumb separator-class="el-icon-arrow-right">
            <el-breadcrumb-item :to="{ path: '/home' }"
                >首页</el-breadcrumb-item
            >
            <el-breadcrumb-item>权限管理</el-breadcrumb-item>
            <el-breadcrumb-item>角色列表</el-breadcrumb-item>
        </el-breadcrumb>
        <el-card class="box-card">
            <el-table :data="rightsList" style="width: 90%" border>
                <el-table-column
                    type="index"
                    label="#"
                    prop="id"
                ></el-table-column>
                <el-table-column prop="authName" label="权限名称" width="180">
                </el-table-column>
                <el-table-column prop="path" label="路径" width="180">
                </el-table-column>
                <el-table-column prop="level" label="权限等级">
                    <template slot-scope="scope">
                        <el-tag v-if="scope.row.level == '0'"
                            >权限等级一</el-tag
                        >
                        <el-tag
                            type="success"
                            v-else-if="scope.row.level == '1'"
                            >权限等级二</el-tag
                        >
                        <el-tag type="info" v-else-if="scope.row.level == '2'"
                            >权限等级三</el-tag
                        >
                    </template>
                </el-table-column>
            </el-table>
        </el-card>
    </div>
</template>
<script>
export default {
  data: function () {
    return {
      // 权限列表数据
      rightsList: []
    }
  },
  created: function () {
    this.getRightsList()
  },
  methods: {
    getRightsList: async function () {
      const { data: res } = await this.$http.get('rights/list')
      this.rightsList = res.data
    //   console.log(res.data)
    }
  }

}
</script>
<style lang="less" scoped>
.rights-box {
    width: 60%;
    .el-breadcrumb {
        font-size: 20px;
    }
    .el-card {
        margin-top: 10px;
        .el-table-column {
            background: rgba(255, 255, 255, 0);
        }
    }
}
</style>
